package com.huterox.todoscheduler.core.wapper;

import com.huterox.todoscheduler.core.enumType.ExecuteType;
import com.huterox.todoscheduler.core.execute.ExecuteCore;

import java.io.Serializable;


public class TaskWrapper implements Runnable, Serializable {

    private ExecuteCore executeCore;

    private ExecuteType executeType = ExecuteType.Run;

    public TaskWrapper() {
    }

    public ExecuteCore getExecuteCore() {
        return executeCore;
    }

    public ExecuteType getExecuteType() {
        return executeType;
    }

    public void setExecuteType(ExecuteType executeType) {
        this.executeType = executeType;
    }

    public void setExecuteCore(ExecuteCore executeCore) {
        this.executeCore = executeCore;
    }

    public TaskWrapper(ExecuteCore executeCore) {
        this.executeCore = executeCore;
    }

    @Override
    public void run() {
        if(executeType==ExecuteType.Run){
            executeCore.run();
        }else if(executeType==ExecuteType.Repair){
            executeCore.repair();
        }

    }
}
